import * as types from '../_types/transaction';

/**
 * 
 * @param targetCoinType 目标货币类型
 * @param targetAmount 目标货币数量
 * @param payCoinType 支付货币类型
 * @param payAmount 支付货币数量
 */
export function Buy(targetCoinType: string, targetAmount: number|string, payCoinType: string, payAmount: number | string) {
    return {
        type: types.Buy,
        payload: {
            targetCoinType,
            targetAmount,
            payCoinType,
            payAmount
        }
    }
}

/**
 * 
 * @param targetCoinType 目标货币类型
 * @param targetAmount 目标货币数量
 * @param payCoinType 支付货币类型
 * @param payAmount 支付货币数量
 */
export function Sell(targetCoinType: string, targetAmount: number|string, payCoinType: string, payAmount: number | string) {
    return {
        type: types.Sell,
        payload: {
            targetCoinType,
            targetAmount,
            payCoinType,
            payAmount
        }
    }
}

/**
 * 充币
 * @param coinType 
 * @param amount 
 */
export function Deposit(coinType: string, amount: number | string) {
    return {
        type: types.Deposit,
        payload: {
            coinType,
            amount
        }
    }
}

/**
 * 提币
 * @param coinType 
 * @param amount 
 */
export function Withdraw(coinType: string, amount: number | string) {
    return {
        type: types.Withdraw,
        payload: {
            coinType,
            amount
        }
    }
}